package com.cysion.study.adapter

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.bumptech.glide.Glide
import com.bumptech.glide.request.RequestOptions
import com.cysion.study.R
import com.cysion.study.entity.Recruits
import com.cysion.study.entity.Researchstus
import com.cysion.study.ktbox.base.BaseAdapter
import com.cysion.study.ktbox.base.BaseViewHolder
import com.cysion.study.ktbox.base.ITEM_CLICK
import kotlinx.android.synthetic.main.item_home_course.view.*

class HomeCourseAdapter(mEntities: MutableList<Recruits>, mContext: Context) :
    BaseAdapter<Recruits>(mEntities, mContext) {
    override fun onCreateViewHolder(
        parent: ViewGroup,
        viewType: Int
    ): BaseViewHolder<Recruits> {

        return ProMoneyHolder(
            LayoutInflater.from(mContext).inflate(R.layout.item_home_course, parent, false)
        )
    }

    class ProMoneyHolder(itemView: View) : BaseViewHolder<Recruits>(itemView) {
        override fun fillData(obj: Recruits, position: Int) {
            itemView?.apply {
                itemView.tv_pro_title.text = obj.name
                itemView.tv_money.text = obj.money+"K"
                itemView.tv_type.text = obj.condition
                itemView.tv_name.text = obj.oName
                itemView.tv_time.text = "00：00"
                itemView.tv_pro_content.text = "规模"//规模
                Glide.with(this).load(obj.images)
                    .apply(RequestOptions.placeholderOf(R.mipmap.place_holder))
                    .into(iv_pro)

                itemView.setOnClickListener {
                    mOnTypeClickListener?.invoke(obj, position, ITEM_CLICK)
                }

            }

        }

    }

}



